package com.example.gowherewash;

import java.net.HttpURLConnection;

import com.example.gowherewash.R;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.TextView;
import gww.utility.*;

public class MainActivity extends Activity {

	private static final String TAG_GET = null;
	private ImageButton main_home_mianfeiwangdian;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		init();
	}

	public void init() {

		String weatherUrl = "http://www.weather.com.cn/data/cityinfo/101010100.html";

		try {
			String b = HttpURLUtility.requestByGet(weatherUrl);
			TextView t = (TextView)findViewById(R.id.home_weather);
			t.setText(b.toCharArray(), 0, b.length());
		} catch (Exception e) {
			Log.i("error", e.getMessage());
		}

		 
		main_home_mianfeiwangdian = (ImageButton) findViewById(R.id.main_home_mianfeiwangdian);

		main_home_mianfeiwangdian.setOnClickListener(new OnClickListener() {
			public void onClick(View view) {
				Intent intent = new Intent();
				intent.setClass(MainActivity.this, FreeActivity.class);
				startActivity(intent);
			}
		});

	}

}
